Don't allow drops in unmounted volumes
authorFederico Mena Quintero <federico@gnome.org>
Wed, 27 Feb 2013 18:16:28 +0000 (12:16 -0600)
committerFederico Mena Quintero <federico@gnome.org>
Wed, 27 Feb 2013 18:16:31 +0000 (12:16 -0600)
Unmounted volumes don't have a URI yet, so we can use that to distinguish them
from within the DnD code.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
gtk/gtkplacessidebar.c

index 517729afe7a3ca766fdd24fb8bd030574385fe2a..63f9834078194cb46bdefe2f33c1cd32ea7e8cbf 100644 (file)
@@ -1444,20 +1444,20 @@ drag_motion_callback (GtkTreeView *tree_view,
 
                        if (!drop_as_bookmarks) {
                                char *uri;
-                               GFile *dest_file;
 
                                gtk_tree_model_get (GTK_TREE_MODEL (sidebar->store),
                                                    &iter,
                                                    PLACES_SIDEBAR_COLUMN_URI, &uri,
                                                    -1);
 
-                               g_assert (uri != NULL);
-                               dest_file = g_file_new_for_uri (uri);
+                               if (uri != NULL) {
+                                       GFile *dest_file = g_file_new_for_uri (uri);
 
-                               emit_drag_action_requested (sidebar, context, dest_file, sidebar->drag_list, &action);
+                                       emit_drag_action_requested (sidebar, context, dest_file, sidebar->drag_list, &action);
 
-                               g_object_unref (dest_file);
-                               g_free (uri);
+                                       g_object_unref (dest_file);
+                                       g_free (uri);
+                               } /* uri may be NULL for unmounted volumes, for example, so we don't allow drops there */
                        }
                }
        }